<script type="text/javascript">
$(function() {
$('a.delimgbutton').click(function(){
	
	//Save the link in a variable called element
	var element = $(this);

	//Find the id of the link that was clicked
	var del_id = element.attr("id");

	//Built a url to send
	var info = 'id=' + del_id;
	
	if(confirm("¿ Esta seguro que desea eliminar esta Imagen ?")){
 		$.ajax({
	   		type: "POST",
	   		url: "/plugins/uploadify/eliminar_imagenes.php",
	   		data: info,
	   		success: function(){
	   		}
 		});
    
	    $(this).parents('div.imgrecord').animate({ backgroundColor: "#fbc7c7" }, "fast")
		.animate({ opacity: "hide" }, "slow");
 	}
	return false;
});
});
</script>
<?php


require_once(dirname(__FILE__).'/../../../config/ProjectConfiguration.class.php');
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', true);
sfContext::createInstance($configuration);
 
// Borra las dos líneas siguientes si no utilizas una base de datos
$databaseManager = new sfDatabaseManager($configuration);
$databaseManager->loadConfiguration();

//Obtengo el id de la noticia



$blog_new = new BlogNew();
$blog_new->setId($_GET['id']);
$blog_new->getMediums();

//$medium->getMediums();

//$con = mysql_query("SELECT * FROM images_news where id_news = $id_new");


foreach ($blog_new->getMediums() as $image) {
    
    echo '<div class="imgrecord" height="230" width="300" style="float:left; margin:0px 5px 5px 5px; border:solid 1px #16AEC5">';						
	echo '<img width="290" height="220" src="'.$image->getFolder().'/'.$image->getUrl().'" style=" display:block; border: solid 1px #DDD;" />';
	echo '<a id="'.$image->getId().'" href="#" class="delimgbutton" style="text-decoration:none; margin:3px 3px 3px 3px"> ';
	echo '<img src="/images_admin/delete.png" title="Eliminar Imagen" /> - Eliminar imagen';
	echo '</a>';
    echo '</div>';      
}
if(count($blog_new->getMediums()) == 0)
{
    echo 'No hay imagenes en esta noticia.';
}

?>